#pragma once

class DirectoryWatch;
class DirectoryListener{
public:
	virtual void onFileAdded(DirectoryWatch* watch, const char* path){}
	virtual void onFileRemoved(DirectoryWatch* watch, const char* path){}
	virtual void onFileModified(DirectoryWatch* watch, const char* path){}
	virtual void onFileRenamed(DirectoryWatch* watch, const char* oldName, const char* newName){}
};

class DirectoryWatchImpl;

class DirectoryWatch{
public:
	DirectoryWatch(DirectoryListener* listener = 0);
	~DirectoryWatch();

	bool install(const char* path, bool recurse);
	void uninstall();

	virtual bool poll();
	void setListener(DirectoryListener* listener);
protected:
	DirectoryWatchImpl* impl_;
	std::string path_;
	DirectoryListener* listener_;

	friend class DirectoryWatchImpl;
};
